package com.szqhyxj.youxiangju.biz.creditCardEvaluation.buycreditcardEvaluation;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.szqhyxj.youxiangju.BaseActivity;
import com.szqhyxj.youxiangju.R;
import com.szqhyxj.youxiangju.biz.core.UserInfoManger;
import com.szqhyxj.youxiangju.biz.merchantHome.shop.pay.AliPayActivity;
import com.szqhyxj.youxiangju.sys.components.NavigationBar;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by leung on 2018/11/9.
 */

public class BuyCreditCardEvaluationActivity extends BaseActivity implements NavigationBar.NavigationBarListener,BuyCreditCardEcaluationContract.View {

    @BindView(R.id.navigationBar)
    NavigationBar navigationBar;
    @BindView(R.id.price)
    TextView price;
    @BindView(R.id.pay)
    TextView pay;
    BuyCreditCardEcaluationPresenter presenter ;

    public static void start(Activity activity) {
        Intent intent = new Intent();
        intent.setClass(activity, BuyCreditCardEvaluationActivity.class);
        activity.startActivity(intent);

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_buy_credit_evaluation);
        ButterKnife.bind(this);
        navigationBar.setNavigationBarListener(this);
        int type = UserInfoManger.INSTANCE.getUser().getUserType();
        if (type == 4 || type == 5) {
            price.setText("9.9");
        } else {
            price.setText("14.9");
        }
        presenter = new BuyCreditCardEcaluationPresenter(this);

    }

    @Override
    public void navigationLeft() {
        finish();
    }

    @Override
    public void navigationRight() {

    }

    @OnClick(R.id.pay)
    public void onClick() {
        presenter.getorder();
    }

    @Override
    public void showBuySuccess(String orderno) {
        AliPayActivity.start(this,orderno,3);
    }
}
